package com.cqie.hospitalescort.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.cqie.hospitalescort.entity.Type;
import com.cqie.hospitalescort.mapper.TypeMapper;
import com.cqie.hospitalescort.model.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * @Desc 类别控制器
 *
 * @author 小伊
 * @date 2022/5/15 15:16
 */
@RestController
@Api(value = "TypeController", tags = {"类型管理"})
public class TypeController extends BaseController{

    @Autowired
    private TypeMapper typeMapper;

    @GetMapping("/type/list")
    @ApiOperation(value = "获取类型列表", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_VALUE)
    public Result<List<Type>> getTypeList(@RequestParam Integer type){
        return response(typeMapper.selectList(new LambdaQueryWrapper<>(Type.class).eq(Type::getStype, type)));
    }
}
